<div class="span12">
	<h2>Cat&eacute;gories</h2>
	
	<div id="ajax-response">
	<?php 
	if(isset($_SESSION['notification'])){
		echo implode(' <br/> ',$_SESSION['notification']);
		unset($_SESSION['notification']);
	}
	?>
	</div>
	
	<form class="form-search pull-right" method="post" accept-charset="utf-8" action="">
		<div class="input-append">
		  	<input name="search_categories" value="" id="tag-search-input" type="text" class="search-query"/>
			<button class="btn" type="submit"><i class="icon-search"></i></button>
		</div>
	</form>
</div>

<div class="row-fluid">

<div class="span4">
<form class="form-horizontal" action="" method="post" id="addtag">

		<button  name="add_category" class="btn" type="submit">Ajouter Nouvelle Categorie</button>
		
<div class="form-field form-required">
	<label for="tag-name">Nom de la catégorie:</label>
	<input onchange="$(this).parents('form').find('#tag-slug').val(convert_accent(this.value));" type="text" aria-required="true" size="40" value="" id="tag-name" name="name" class="input-xlarge"/>

	
	<label for="tag-slug">URL simplifié:</label>
	<input type="text" size="40" value="" id="tag-slug" name="slug" class="input-xlarge"/>
	<p>L'URL simplifié est généré automatiquement. Il dois etre en minuscules, uniquement des lettres/chiffres et  traits d'union pour les espace.</p>

	
	<label for="parent">Parent :</label>
	<select class="postform" id="parent" name="parent">
		<option value="0">Aucun</option>
		<?php echo $option_category?>
	</select>
			<p>Les Catégories peuvent avoir une hiérachie. Exemple catégorie principale &quot;Voiture&quot; et sous catégorie &quot;Electrique&quot; et &quot;Essence&quot;</p>

			
	<label for="tag-description">Description :</label>
	<textarea class="row-fluid" rows="5" id="tag-description" name="description"></textarea>
	<p>La description n'est pas visible, par d&eacute;faut, cependant certains th&egrave;mes peuvent &ecirc;tre vue.</p>
	
	
	<label for="showPrice" class="checkbox">Afficher le prix ?
		<input id="showPrice" name="showPrice" value="1" type="checkbox" checked="checked"/>
	</label>
			<p>Le Catégorie ne peuvent pas avoir un prix. Exemple catégorie rencontre</p>
	
</div>

 <a href="<?php echo $CFG->config['base_url']?>setting/option">Option :</a>
	<table class="table table-condensed">
	<?php
	if(!empty($CategoryListOption))
		foreach($CategoryListOption as $list){
	?>
		<tr>
			<td>
            <input type="checkbox" value="<?php echo $list->id_type?>" 
            name="option[]" />  </td>
			<td><a href="<?php echo "{$CFG->config['base_url']}setting/option#option-{$list->id_type}"?>"><?php echo $list->name?></a></td>
		</tr>
	<?php }?>
	</table>

		<button  name="add_category" class="btn" type="submit">Ajouter Nouvelle Categorie</button>
</form>
</div>



<div class="span8">
<form id="posts-filter" method="post" accept-charset="utf-8" class="form-search" action="">
	<div class="tablenav top">
		<div class="alignleft actions">
		<select name="action">
			<option>Action globale</option>
			<option value="delete">Supprimer</option>
		</select>
		<button class="btn" type="submit">Appliquer</button>
		</div>
 
	</div>
<table  class="table table-striped">
	<thead>
	<tr>
	<th class="span1"></th>
	<?php
		if(isset($tableCategoryHeader))
		foreach ($tableCategoryHeader as $nameTable=>$tableHeader){
			if($nameTable) 
				echo '<th class="column-'.$nameTable.'" id="'.$nameTable.'">
							<a href="#'.$nameTable.'">'.$tableHeader.'<b class="caret"></b></a>
					</th>
					';
			else echo '<th class="column-'.$nameTable.'" id="'.$nameTable.'">
						<input type="checkbox" id="cb-select-all-1">
					</th>
						';
		}
		
	?>
	</tr>
	</thead>

	<tfoot>
		<tr>
		<th></th>
		<?php 
		if(isset($tableCategoryHeader))
		foreach ($tableCategoryHeader as $nameTable=>$tableHeader){
			if($nameTable) 
				echo '<th class="column-'.$nameTable.'" id="'.$nameTable.'">
							<a href="#'.$nameTable.'">'.$tableHeader.'<b class="caret"></b></a>
					</th>
					';
			else echo '<th class="column-'.$nameTable.'" id="'.$nameTable.'">
						<input type="checkbox" id="cb-select-all-1">
					</th>
						';
		}
		?>
		</tr>
	</tfoot>

	<tbody id="the-list">
	<?php 
	foreach($tableCategoryBody as $row){
	
		$id=$row['id'];
			echo "
		<tr class='alternate' id='tag-$id'>
			<th>
				<a title='up {$row['name']}' href='admin/up/$id'><i class='icon-arrow-up btn-link'></i></a>
				<a title='down {$row['name']}' href='admin/down/$id'><i class='icon-arrow-down btn-link'></i></a>
			</th>
			<th><input type='checkbox' id='cb-select-$id' value='$id' name='delete_tags[]'></th>
			<td class='show-action'><strong><a title='Edit {$row['name']}' href='admin/edit/$id' class='row-title'>{$row['name']}</a></strong><br>
				<div class='row-actions'>
				<a href='admin/edit/$id' title='Modifier'><i class='icon-edit'></i></a> | 
				<span class='inline editinline' title='Modifier rapide' > <i class='icon-pencil'></i> | </span>
				<a href='admin/delete/$id' class='delete-tag' title='Supprimer'><i class='icon-trash'></i></a> | 
				<a href='{$CFG->config['base_url']}{$row['link']}/' title='Voir'><i class='icon-eye-open'></i></a>
				</div>
				<div id='inline_$id' class='hide'>
					<div class='name'>{$row['short-name']}</div>
					<div class='slug'>{$row['slug']}</div>
					<div class='parent'>{$row['parent']}</div>
				</div>
			</td>
			<td>{$row['slug']}</td>
			<td class='span4'><small>{$row['option']}</small></td>
			<td>{$row['count']}</td>
		</tr>";
		}
	?>
	</tbody>
</table>
	<div class="tablenav bottom">
		<div class="alignleft actions">
		<select name="action">
			<option>Action globale</option>
			<option value="delete">Supprimer</option>
		</select>
		<input type="submit" value="Appliquer" name="doaction" />
		</div>
		<br class="clear">
	</div>

<br class="clear">
</form>

<div class="form-wrap">
<p><strong>Note:</strong><br>
  Supprimer une cat&eacute;gorie ne supprime pas les m&eacute;ssages pr&eacute;sent dans celle ci.
Cependant les messages qui ont &eacute;t&eacute; affect&eacute;s sont mis dans la cat&eacute;gorie <strong>Non class&eacute;</strong>.</p>
<p>Les cat&eacute;gories selectionn&eacute;es peuvent etre converti en utilisant des balises pour <a href="import.php">marquer la cat&eacute;gorie</a>.</p>
</div>

</div>
</div>


<table style="display: none">
	<tbody>
		<tr style="display: none" class="inline-edit-row" id="inlineedit">
		<td colspan="5">

		<form action="" method="post" class="form-horizontal">
			<h5>Edition Rapide</h5>
		<div class="control-group">
			<label class="control-label" >Nom</label>
			<div class="controls">
				<input onchange="$(this).parents('form').find('#tag-slug').val(convert_accent(this.value));" id="tag-name" type="text" value="" class="input-xxlarge" name="name" />
			</div>
			
			<label class="control-label" >Slug</label>
			<div class="controls"><input id="tag-slug" type="text" value="" class="input-xxlarge" name="slug"/></div>
 		</div>
			<div class="controls">
				<button class="btn" title="Cancel" onclick="$(this).parents('.inline-edit-row').hide()" >Annuler</button>
				<button class="btn" name="Update_Category"  value="Update_Category" type="submit" accesskey="u">Update Category</button>
			</div>
	
			<input type="hidden" value="" name="id"/>
			<input type="hidden" value="" name="parent"/>
		
		</form>
		</td>
		</tr>
	</tbody>
</table>